package user_router

import (
	"github.com/gin-gonic/gin"

	userCcontrollers "huijing_mall/api/user"

	"huijing_mall/api/middleware"
)

func RouterUser(r *gin.Engine) {
	v1 := r.Group("/api/v1")
	v1.POST("/login", userCcontrollers.Login)          //登录（首次注册）
	v1.POST("/reg", userCcontrollers.Register)         //注册
	v1.POST("/update_pwd", userCcontrollers.UpdatePwd) //修密码

	user := r.Group("/user/api", middleware.AuthMiddleware())
	{
		user.GET("/Login_out", userCcontrollers.LoginOut)          //退出登录
		user.POST("/upload-avatar", userCcontrollers.UploadAvatar) //修改头像
		user.GET("/welcome-info", userCcontrollers.GetUserInfo)    //获取用户信息
		user.POST("/add-address", userCcontrollers.AddAddress)     //添加地址
		user.GET("/find-address", userCcontrollers.FindAddress)    //查询地址
	}

}
